﻿
using System;
using System.Data.Entity;

namespace Nikola.Models.DataAccess
{
    /// <summary>
    /// 初始化数据库
    /// </summary>
    public class InitDataBase
    {
        public void Init()
        {
            //如果有属性变动重新生成数据库
            Database.SetInitializer(strategy: new DropCreateDatabaseIfModelChanges<NikolaContext>());
            using (var context = new NikolaContext())
            {
                context.Database.Initialize(true);
            }

        }
    }
}